#include <tcr.cc>
#include <iostream>

using namespace std;

Point random_point()
{
	return mk_point(rand() % 2000 - 1000, rand() % 2000 - 1000, 1);
}

int main()
{
	int ii;
	Point a, b, c, o;
	Rational p, q, r;

	for(ii = 0; ii < 1000; ii++)
	{
		a = random_point();
		b = random_point();
		c = random_point();

		if(full_dot(a, cross(b, c)) == 0)
		{
			ii--;
			continue;
		}
		
		o = circumcentre(a, b, c);

		p = norm(vec_sub(a, o));
		q = norm(vec_sub(a, o));
		r = norm(vec_sub(a, o));
		if(!are_equal(p, q) || !are_equal(q, r) || !are_equal(p, r))
         cout << "FAILED " << ii+1 << ":"
            << "\n\tA: " << a.x << " " << a.y << " " << a.z
            << "\n\tB: " << b.x << " " << b.y << " " << b.z
            << "\n\tC: " << c.x << " " << c.y << " " << c.z
            << "\n\tO: " << o.x << " " << o.y << " " << o.z
            << endl;
		else
			printf("PASSED %d\n", ii+1);
	}

   return 0;
}
